import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/HomeView.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/home/index'
  },{
    path: '/usercenter',
    redirect: '/usercenter/welcome'
  },
  {
    path: '/pushCard',
    name: 'pushCard',
    component: () => import('../views/pushCard/pushCard.vue'),
  },
  {
    path: '/home',
    name: 'home',
    component: () => import('../views/HomeView.vue'),
    children:[
      {
        path: 'index',
        name: 'index',
        component: () => import('../views/index/Index.vue'),
      },      {
        path: 'activity',
        name: 'activity',
        component: () => import('../views/activity/Activity.vue'),
      },      {
        path: 'community',
        name: 'community',
        component: () => import('../views/community/Community.vue'),
      },      {
        path: 'login',
        name: 'login',
        component: () => import('../views/login/login.vue'),
      },      {
        path: 'register',
        name: 'register',
        component: () => import('../views/register/register.vue'),
      },      {
        path: 'create',
        name: 'create',
        component: () => import('../views/create/create.vue'),
      },      {
        path: 'actdetail',
        name: 'actdetail',
        component: () => import('../views/activityDetail/activityDetail.vue'),
      },{
        path: 'usercenter',
        name: 'usercenter',
        component: () => import('../views/userCenter/userCenter.vue'),
      },
      {
        path: 'topic',
        name: 'topic',
        component: () => import('../views/topic/topic.vue'),
      }
    ]
  },{
    path: '/usercenter',
    name: 'usercenter',
    component: () => import('../views/userCenter/userCenter.vue'),
    children: [
      {
        path: 'userinformation',
        name: 'userinformation',
        component: () => import('../views/userCenter/Information.vue'),
      
      },{
        path: 'information',
        name: 'information',
        component: () => import('../views/userCenter/Information.vue'),
      },{
        path: 'shippingaddress',
        name: 'shippingaddress', 
        component: () => import('../views/userCenter/ShippingAddress.vue'),
      },{
        path: 'modifyavatar',
        name: 'modifyavatar',
        component: () => import('../views/userCenter/ModifyAvatar.vue'),
      },{
        path: 'resetpassword',
        name: 'resetpassword', 
        component: () => import('../views/userCenter/ResetPassword.vue'),
      },{
        path: 'welcome',
        name: 'welcome', 
        component: () => import('../views/userCenter/welcome.vue'),
      },
    ]
 }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
